<?php
include_once "BaseDAO.php";
include_once $_SERVER ['DOCUMENT_ROOT'] . '/ad/sys/com/model/util/plog/classes/plog.php';
include_once $_SERVER ['DOCUMENT_ROOT'] . '/ad/sys/com/model/db/publish/PublishClickedAdDAO.php';
include_once $_SERVER ['DOCUMENT_ROOT'] . '/ad/sys/com/model/db/publish/ClickedAdSumpayDAO.php';
include_once $_SERVER ['DOCUMENT_ROOT'] . '/ad/sys/com/model/db/AppInfoDAO.php';

class PaysettingDAO extends BaseDAO {
	
	public function __construct() {
		parent::__construct ();
		$this->log = Plog::factory ( __FILE__ );
	}
	
	public function update($cpc, $cpm, $cpcPublish, $cpmPublish) {
		$sql = "update paysetting set CPC=$cpc,CPM=$cpm,CPCPublish=$cpcPublish,CPMPublish=$cpmPublish";
		$reuslt =  mysql_query($sql);
		
		return $reuslt;
	}
	
	public function getInfo() {
		$sql = "select * from paysetting ";
//		echo "$sql<br/>";
		return $this->toArray ( @mysql_query ( $sql ) );
	}
	
	
	public function add($cpc, $cpm, $cpcPublish, $cpmPublish) {
		try {
			$sql = "INSERT INTO `paysetting` (
				   `CPC`, `CPM`, `CPCPublish`, `CPMPublish`) 
				    VALUES ($cpc,$cpm,$cpcPublish,$cpmPublish);";
			
			
			$result = @mysql_query ( $sql ) or die ( mysql_error () );
			$adId = @mysql_insert_id ();
		} catch ( Exception $e ) {
			mysql_error ();
			throw $e;
		}
	
	}

}

?>